<?php

use Illuminate\Http\Request;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/


Route::middleware('auth:api')->get('/user', function (Request $request) {
    return $request->user();
});

//api路由
Route::namespace('Api')->group(function(){
    //用户模块
    Route::prefix('user')->namespace('User')->group(function(){
        #用户类
        Route::post('login','UserBaseController@do_login');#登录
        Route::post('reg','UserBaseController@do_reg');#注册
        Route::post('get_sms_code','UserBaseController@get_sms_code');#获取验证码
        Route::post('check_sms_code','UserBaseController@check_sms_code');#检测验证码
        Route::post('forget_password','UserBaseController@forget_password');#忘记密码
        Route::post('myUCenter','UCenterController@myUCenter');#忘记密码

        #收货地址类
        Route::post('addAddress','UCenterController@addAddress');#新增地址
        Route::post('editAddress','UCenterController@editAddress');#修改地址
        Route::post('addressList','UCenterController@addressList');#地址列表
        Route::post('delAddress','UCenterController@delAddress');#删除地址
    });

    //首页模块
    Route::group(['namespace'=>'Main','prefix'=>'main'],function (){
        #轮播获取
        Route::get('banner_list','MainController@banner');
        Route::get('get_cate','MainController@getTopCate');
        Route::get('get_cates','MainController@getCates');
        Route::get('get_hot_goods','MainController@getHotGoods');
        Route::get('get_goods','MainController@getGoods');

        Route::post('search_goods','MainController@serachGoods');
    });

});
